// generate tokens
#pragma once

#include <string>
#include <vector>
#include <exception>

// for debug
#include <iostream>


enum TokenType {
	ELEMENT,
	NUMBER,
	SPACE,
	LEFTPARENTH,
	RIGHTPARENTH,
	ENDOFFILE,
};

struct Token {
	TokenType type;
	std::string value;
	Token(TokenType type, std::string value);
	std::string to_string();
};

class Lexer {
	std::string input;
	std::vector<Token> tokens;
	int position = 0;
public:
	Lexer();
	Lexer(std::string input);
	std::vector<Token> tokenize();
private:
	bool isEnd();
	inline char advance();
	inline void backward();
	inline char peek();
	void scanToken();
	void error(std::string info);
	void addNumber();
	void addElement();
};